package com.zd.kids.ui.view;

import android.content.Context;
import android.util.AttributeSet;
import android.util.Log;
import android.widget.ImageView;

import com.shuyu.gsyvideoplayer.video.NormalGSYVideoPlayer;
import com.zd.kids.R;

/**
 * @ClassName: com.zd.kids.ui.view
 * @Description:
 * @Author: hyy
 * @Date: 2020/7/1
 * @Time: 6:20 PM
 */
public class MyVideoPlayer extends NormalGSYVideoPlayer {
    public MyVideoPlayer(Context context, Boolean fullFlag) {
        super(context, fullFlag);
    }

    public MyVideoPlayer(Context context) {
        super(context);
    }

    public MyVideoPlayer(Context context, AttributeSet attrs) {
        super(context, attrs);
    }


    public ImageView getLoack() {
        return mLockScreen;
    }

    @Override
    protected void changeUiToNormal() {
        super.changeUiToNormal();
    }

    public void lockTouch() {
        mLockScreen.setImageResource(R.drawable.lock);
        mLockCurScreen = true;
        hideAllWidget();
    }


    public void unLockTouch() {
        mLockScreen.setImageResource(R.drawable.unlock);
        mLockScreen.setVisibility(VISIBLE);
        mLockCurScreen = false;
    }

    @Override
    public int getLayoutId() {
        return R.layout.video_layout_preview;
    }

    @Override
    protected void updateStartImage() {
        super.updateStartImage();
        if (mStartButton instanceof ImageView) {
            ImageView imageView = (ImageView) mStartButton;
            if (mCurrentState == CURRENT_STATE_PLAYING) {
                imageView.setImageResource(R.mipmap.ic_video_pause_state);
            } else if (mCurrentState == CURRENT_STATE_ERROR) {
                imageView.setImageResource(R.drawable.video_click_error_selector);
            } else {
                imageView.setImageResource(R.mipmap.ic_video_start_state);
            }
        }
    }

    @Override
    protected void startDismissControlViewTimer() {
        super.startDismissControlViewTimer();
        Log.i("MyVideoPlayer","==startDismissControlViewTimer==");
    }

    @Override
    protected void hideAllWidget() {
        super.hideAllWidget();
        Log.i("MyVideoPlayer","==MyVideoPlayer==");
    }



}
